package functional;

import java.util.function.DoubleFunction;
import java.util.function.DoubleToIntFunction;
import java.util.function.DoubleToLongFunction;
import java.util.function.Function;
import java.util.function.IntFunction;
import java.util.function.IntToDoubleFunction;
import java.util.function.IntToLongFunction;
import java.util.function.LongFunction;
import java.util.function.LongToDoubleFunction;
import java.util.function.LongToIntFunction;
import java.util.function.ToDoubleFunction;
import java.util.function.ToIntFunction;
import java.util.function.ToLongFunction;

class Foo {
}

class Bar {
	Foo f;

	Bar(Foo f) {
		this.f = f;
	}
}

class IBaz {
	int i;

	public IBaz(int i) {
		this.i = i;
	}
}

class LBaz {
	long l;

	public LBaz(long l) {
		this.l = l;
	}
}

class DBaz {
	double d;

	public DBaz(double d) {
		this.d = d;
	}
}

public class FunctionVariants {
	static Function<Foo, Bar> f1 = f -> new Bar(f);
	static IntFunction<IBaz> f2 = i -> new IBaz(i);
	static LongFunction<LBaz> f3 = l -> new LBaz(l);
	static DoubleFunction<DBaz> f4 = d -> new DBaz(d);
	static ToIntFunction<IBaz> f5 = ib -> ib.i;
	static ToLongFunction<LBaz> f6 = lb -> lb.l;
	static ToDoubleFunction<DBaz> f7 = db -> db.d;
	static IntToLongFunction f8 = i -> i;
	static IntToDoubleFunction f9 = i -> i;
	static LongToIntFunction f10 = i -> (int) i;
	static LongToDoubleFunction f11 = i -> i;
	static DoubleToIntFunction f12 = i -> (int) i;
	static DoubleToLongFunction f13 = i -> (long) i;

	@SuppressWarnings("unused")
	public static void main(String[] args) {
		Bar b = f1.apply(new Foo());
		IBaz ib = f2.apply(11);
		LBaz lb = f3.apply(11);
		DBaz db = f4.apply(11);
		int i = f5.applyAsInt(ib);
		long l = f6.applyAsLong(lb);
		double d = f7.applyAsDouble(db);
		l = f8.applyAsLong(12);
		d = f9.applyAsDouble(12);
		i = f10.applyAsInt(12);
		d = f11.applyAsDouble(12);
		i = f12.applyAsInt(13.0);
		l = f13.applyAsLong(13.0);
	}
}
